import classNames from 'classnames';
import {connect} from 'react-redux';
import React from 'react';

import BufferedInputHOC from '../forms/buffered-input-hoc.jsx';
import Input from '../forms/input.jsx';
const BufferedInput = BufferedInputHOC(Input);

import styles from './project-title-input.css';

const ProjectTitleInput = ({
    className,
    //canEdit,
    projectTitle,
    onSubmit
}) => (
    <BufferedInput
        className={classNames(styles.titleField, className)}
        maxLength="100"
        placeholder="在此填写作品标题"
        tabIndex="0"
        type="text"
        //disabled={!canEdit}
        value={projectTitle}
        onSubmit={onSubmit}
    />
);

ProjectTitleInput.propTypes = {
    //className: PropTypes.string,
    //canEdit:PropTypes.bool,//能否编辑标题
    //projectTitle: PropTypes.string,

    //onSubmit: PropTypes.func
};
const mapStateToProps = state => ({
    projectTitle: state.project.title
});
const mapDispatchToProps = dispatch => ({});

export default connect(
    mapStateToProps,
    mapDispatchToProps
)(ProjectTitleInput);
// export default injectIntl(connect(
//     mapStateToProps,
//     mapDispatchToProps
// )(ProjectTitleInput));
